<!DOCTYPE html>
<html class="x-admin-sm">

<head>
  <meta charset="UTF-8" />
  <title></title>
  <meta name="renderer" content="webkit" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
  <link rel="stylesheet" href="./css/font.css">
  <link rel="stylesheet" href="./css/xadmin.css">
  <link rel="stylesheet" href="./lib/layui/css/layui.css" />
  <link rel="stylesheet" href="./css/link.css" />
  <script type="text/javascript" src="./js/xadmin.js"></script>
</head>

<body>
  <div class="x-nav">
    <span class="layui-breadcrumb">
      <a href="">首页</a>
      <a href="">演示</a>
      <a> <cite>导航元素</cite></a>
    </span>
    <a class="layui-btn layui-btn-small" style="line-height: 1.6em; margin-top: 3px; float: right"
      onclick="location.reload()" title="刷新">
      <i class="layui-icon layui-icon-refresh" style="line-height: 30px"></i></a>
  </div>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15" style="font-size: 18px;">
      <!-- 这是友情链接列表、修改、删除、增加 -->
      <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
          <li class="layui-this" id="wordUrl">文字链接</li>
          <li id="pictureUrl">图片链接</li>
          <button type="button" class="layui-btn layui-btn-primary" id="btnAddLink">
            + 新增
          </button>
        </ul>
        <div class="layui-tab-content" id="table-content">
          <div class="layui-tab-item layui-show">
            <!-- 文字链接区域 -->
            <table class="layui-table">
              <colgroup>
                <col width="40" />
              </colgroup>
              <thead>
                <tr>
                  <th>#</th>
                  <th>标题</th>
                  <th>链接描述</th>
                  <th>链接类型</th>
                  <th>链接地址</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody id="tb1"></tbody>
            </table>
          </div>

          <div class="layui-tab-item">
            <!-- 图片链接 -->
            <table class="layui-table">
              <colgroup>
                <col width="40" />

              </colgroup>
              <thead>
                <tr>
                  <th>#</th>
                  <th>链接描述</th>
                  <th>链接图片</th>
                  <th>链接类型</th>
                  <th>链接地址</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody id="tb2"></tbody>
            </table>
            <!-- <div id="pageBox"></div> -->
          </div>
        </div>

        <!-- 分页区域 -->
        <div id="pageBox" style="float: right; margin-right: 10px;"></div>
      </div>
    </div>
  </div>
  <!-- 添加链接弹框-->
  <script type="text/html" id="Link-add">
      <form class="layui-form" id="form-add" lay-filter="form-add" style="margin-left: 10%; margin-top: 20px;">
           <!-- 隐藏域 -->
        <input type="hidden" name="id">
        <div class="layui-form-item">
          <label class="layui-form-label">链接类型</label>
          <div class="layui-input-block ">
              <select name="type"  lay-verify="required" id="sel_link" lay-filter="select1">
                <option  value=" ">请选择</option>
                <option value="1">文字链接</option>
                <option value="2">图片链接</option>
              </select> 
          </div>
        </div>
        <div class="layui-form-item w_title">
          <label class="layui-form-label">标题</label>
          <div class="layui-input-block">
            <input type="text"name="title" id="add_title" requiredlay-verify="required"placeholder="请输入标题" autocomplete="off"class="layui-input"/>
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">链接地址</label>
          <div class="layui-input-block">
            <input type="text"name="url" id="add_pwd" requiredlay-verify="required"placeholder="请输入链接地址" autocomplete="off"class="layui-input"/>
          </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">链接描述</label>
          <div class="layui-input-block">
            <textarea name="des" autocomplete="off" id="add_des" placeholder="请输入链接描述名称" rows="2" class="el-textarea__inner" style="min-height: 33px; height: 74px; width: 380px;"></textarea>
          </div>
        </div>

        <div class="layui-form-item  t_picture" >
          <label class="layui-form-label">链接图片</label>
          <div class="layui-input-block" id="ff">
            <button type="submit" class="layui-btn" id="btnChooseImage">
              <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
            <input name="img" type="file" id="file" accept="image/png,image/jpeg">
          </div>
        </div>
        <div class="layui-form-item" >
          <div class="layui-input-block" style="float: right; margin-right: 20px; ">
            <button class="layui-btn layui-btn-primary layui-border-blue" id="btn_cancel" lay-filter=""> 取消 </button>
            <button class="layui-btn" lay-submit lay-filter="formDemo" id="btn-add">增加</button>
          </div>
        </div>
      </form>
    </script>


  <!-- 修改 -->
  <script type="text/html" id="Link-edit">
      <form class="layui-form" id="form-edit" lay-filter="form-edit" style="margin-left: 10%; margin-top: 20px;">
         <!-- 隐藏域 -->
         <input type="hidden" name="id">
        <div class="layui-form-item">
          <label class="layui-form-label">链接类型</label>
          <div class="layui-input-block">
            <select name="type" lay-verify="required" id="sel_link" lay-filter="select1">
              <option value=" ">请选择</option>
              <option value="1">文字链接</option>
              <option value="2">图片链接</option>
            </select> 
          </div>
        </div>
        <div class="layui-form-item w_title">
          <label class="layui-form-label">标题</label>
          <div class="layui-input-block">
            <input type="text"name="title" id="edit_title" requiredlay-verify="required"placeholder="请输入标题" autocomplete="off"class="layui-input"/>
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">链接地址</label>
          <div class="layui-input-block">
            <input type="text" name="url" required lay-verify="required" placeholder="请输入链接地址" autocomplete="off" class="layui-input" />
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">链接描述</label>
          <div class="layui-input-block">
            <textarea name="des" autocomplete="off" placeholder="请输入链接描述" rows="2" class="el-textarea__inner" style="min-height: 33px; height: 74px; width: 380px;"></textarea>
          </div>
        </div>
        <div class="layui-form-item  t_picture" >
          <label class="layui-form-label">链接图片</label>
          <div class="layui-input-block" id="ff">
            <button type="submit" class="layui-btn" id="btnChooseImage">
              <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
            <input type="file" id="file" accept="image/png,image/jpeg">
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-input-block" style="float: right; margin-right: 20px;">
            <button class="layui-btn layui-btn-primary layui-border-blue" id="btn_cancel"lay-filter=""> 取消 </button>
            <button class="layui-btn" lay-submit lay-filter="formDemo" id="btn-edit">确认修改</button>
          </div>
        </div>
      </form>
    </script>




  <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script src="./lib/layui/layui.all.js"></script>
  <script src="./lib/layui/lay/modules/axios.js"></script>
  <script src="./js/api.js"></script>
  <script src="./js/link.js"></script>
</body>

</html>